<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>

<body>
    <div id="app">
        <el-form v-model="form" label-width="100px" class="process-edit-form">
            <el-form-item v-for="item in formParams" :key="item.name" :label="item.name + '：'">
                <com1 :html="item.html" :form="form"></com1>
                <!-- 这里取 item.html并渲染-->
            </el-form-item>
        </el-form>
        {{ form }}
    </div>
</body>
<!-- 先引入 Vue -->
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
    Vue.component('com1', {
        props: {
            html: String,
            form: Object,
        },
        render(h) {
            const com = Vue.extend({
                template: this.html,
                props: {
                    form: Object,
                }
            })

            return h(com, {
                props: {
                    form: this.form
                }
            })
        }
    })

    var app = new Vue({
        el: "#app",
        data: {
            button: '<el-button type="primary">按钮</el-button>',
            form: {
                name: '',
                age: ''
            },
            formParams: [{
                    name: '名称',
                    type: 'name',
                    html: '<el-input v-model.trim="form.name"></el-input>'
                },
                {
                    name: '年龄',
                    type: 'age',
                    html: '<el-input v-model.trim="form.age"></el-input>'
                },
            ]
        },
        mounted() {
            this.$nextTick(function () {
                this.$forceUpdate();
            })
        }
    })
</script>

</html>